package org.webframe.beetlsql;

import java.util.HashMap;

import org.beetl.sql.core.IDAutoGen;
import org.beetl.sql.ext.spring4.SqlManagerFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.ibeetl.starter.BeetlSqlCustomize;


@Configuration
public class BeetlSQLConfig {
	@Bean
	 public BeetlSqlCustomize beetlSqlCustomize(){
	    return  new BeetlSqlCustomize(){

			@SuppressWarnings("rawtypes")
			public void customize(SqlManagerFactoryBean sqlManagerFactoryBean) {
				HashMap<String,IDAutoGen> idGensMap = new HashMap<String,IDAutoGen>();
				idGensMap.put("snowflake", new IDAutoGen(){
					public Object nextID(String arg0) {
						return new Snowflake(0).nextId();
					}});
				sqlManagerFactoryBean.setIdAutoGens(idGensMap);
			}
	  };
	}
	
}
